<template>
  <div id="app">

      <ul class="photo-list">
        <router-link v-for="item in photoList" :key="item.id" :to="'/home/photoInfo/' + item.id" tag="li">
          <img v-lazy="item.topImg">
          <div class="info">
            <h1 class="info-title">{{ item.title }}</h1>
            <div class="info-body">
              {{ item.zy }}
            </div>
          </div>
        </router-link>
    </ul>


  </div>
</template>

<script>
export default {
  data() {
    return {
        photoList: []
    }
  },
  methods: {
      getSwipeItem() {
        this.$http.get('http://192.168.31.40:8080/vue/getPhotoList').then(result => {
          if (result.body.status === 0) {
            this.photoList = result.body.message;
          }
        });
      }
  },
  created() {
    this.getSwipeItem();
  }

}
</script>

<style scoped>

  .photo-list {
    list-style: none;
    margin: 0;
    padding: 10px;
    padding-bottom: 0;
  }

  .photo-list li {
    background-color: #ccc;
    text-align: center;
    margin-bottom: 10px;
    box-shadow: 0 0 9px #999;
    position: relative;
  }
  .photo-list li img {
    width: 100%;
    vertical-align: middle;
  }
  .photo-list li img[lazy=loading] {
    width: 40px;
    height: 300px;
    margin: auto;
  }

  .info {
    color: white;
    text-align: left;
    position: absolute;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.4);
    max-height: 84px;
  }
  .info .info-title {
    font-size: 14px;
  }
  .info .info-body {
    font-size: 12px;
  }
</style>
